package weekend3;

import java.util.ArrayList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {

        List<String> list=new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        list.add("one");
        System.out.println(list);

        System.out.println(list.get(4));

        String old=list.set(2,"six");
        System.out.println(old);
        System.out.println(list);

        String old1=list.remove(0);
        System.out.println(old1);
        System.out.println(list);

        list.add(2,"nine");
        System.out.println(list);

        List<String> subList=list.subList(2,5);
        System.out.println(subList);
    }
}
